#!/usr/bin/env python3.3

#
#  Filename: e64.py
#  Author  : lukas singer
#
#  Comment : Created by createSolution.sh
#

#import euler
#from euler import *
from math import floor

def getPeriodLength(s):
  for i in range(len(s)):
    sub=s[i]
    for j in range(i+1,len(s)-1):
      sub+=s[j]
      if s[i]==s[j+1]:
        if s[j+1:j+1+len(sub)]==sub:
          b=True
          l=0
          for k in range(j+1,len(s)-1):
            if s[k]!=sub[l]:
              b=False
              break
            l+=1
            if l>=len(sub):
              l=0
          if b:
            if len(sub)==2 and sub[0]==sub[1]:
              return 1
            else:
              return len(sub)
            #period starts at s[j+1] and is len(sub) characters long
  return 0
  #the given list or string is not periodic!


def pe64():
  result=0
  limit=10000
  for i in range(2,limit+1):
    a0=int(i**0.5)
    if a0*a0==i: continue
    cnt=0
    d=1
    m=0
    a=a0
    m=d*a-m
    d=(i-m*m)//d
    a=(a0+m)//d
    cnt+=1
    while a!=2*a0:
      m=d*a-m
      d=(i-m*m)//d
      a=(a0+m)//d
      cnt+=1
    if cnt%2==1:
      result+=1
  print(result)

# i first missunderstood the problem and looked for periods after the komma
#  cnt=0
#  for n in range(1,14):
#    s=str(n**0.5)
#    p=getPeriodLength(s[s.find('.'):])
#    print(s[s.find('.'):],p)
#    if p%2==1:
#      cnt+=1
#  print(cnt)

if __name__=="__main__":
  pe64()

